home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 003a / modified.zip / PLAY1.ASM < prev   
Assembly Source File  |  1993-03-26  |  5KB  |  165 lines

  1. .model large,pascal
  2. .stack 200h
  3.  
  4. ;Procedures:
  5. public player
  6. public dob1
  7. public dob2
  8. public dob3
  9. public dob4
  10.  
  11. EXTRN  INITIALIZE:FAR            ; Initializes the modplayer for given
  12.                                  ; sounddevice and replayrate
  13.  
  14. EXTRN  LOADMODULE:FAR            ; Loads the Module into memory
  15.  
  16. EXTRN  STARTPLAYING:FAR          ; Starts playing the module
  17.  
  18. EXTRN  STOPPLAYING:FAR           ; Stops playing the module
  19.  
  20. EXTRN  DEALLOC:FAR               ; Deallocates and erases the module
  21.                                  ; from memory
  22.  
  23. EXTRN  ASKINIT:FAR
  24.  
  25. ;Variables:
  26.  
  27. EXTRN  SOUNDDEVICE:WORD          ; The Sounddevice number
  28.  
  29. EXTRN  TIMERSPEED:WORD           ; The replayrate 1193182/Hertz
  30.  
  31. EXTRN  SBDMA:WORD                ; SoundBlaster's DMA-Channel
  32.  
  33. EXTRN  SBIRQNR:WORD              ; SoundBlaster's IRQ-Number
  34.  
  35. ;Special_Variables:
  36.  
  37. EXTRN  BAR1:WORD  ; Selfdecrementing Bars, see the docs
  38. EXTRN  BAR2:WORD  ; Selfdecrementing Bars, see the docs
  39. EXTRN  BAR3:WORD  ; Selfdecrementing Bars, see the docs
  40. EXTRN  BAR4:WORD  ; Selfdecrementing Bars, see the docs
  41. EXTRN  MASTERVOLUME:Word    ; Mastervolume from 0 to 64
  42.  
  43. .data
  44.           Error1   Db 13,10,10,7,'Module not found',13,10,'$'
  45.           Filename db 'fanta2.mod',0  ;This is the mod to play
  46.           Info     db 'Developed by Bob Hass, 93',0
  47.           ;EXTRN Filename:FAR
  48. .code
  49.  
  50. player Proc
  51.  
  52.        mov ah,0                    ;
  53.        mov al,13h                  ;
  54.        int 13h                     ; Set 320 x 200 256 Color Graphics Mode
  55.  
  56.        Mov  Ah,4Ah                 ;Reduce program memory size
  57.        Mov  Bx,65534/16            ;Approx. size of compiled EXEFILE / 16 + 2
  58.        Int  21h
  59.  
  60.        Mov  Ax,Seg SoundDevice
  61.        Mov  Es,Ax                  ; Makes ES point to the player-segment
  62.        Mov  Es:SoundDevice,6       ; Set Soundblaster = 4
  63.        Mov  Es:TimerSpeed,58       ; The sampling rate...........
  64.                                    ; Set 16 kHz (1193182/16000=75)
  65.                                    ; Set 12 kHz (1193182/12000=100)
  66.                                    ; Set 10 kHz (1193182/10000=120)
  67.                                    ; Set 8  kHz (1193182/8000=150)
  68.                                    ; Set 6  kHz (1193182/6000=198)
  69.                                    ; Set TimerSpeed higher for slower machines
  70.        mov  es:SBDMA,1
  71.        mov  es:SBIRQNR,5
  72.        Call Initialize             ;Initialize the SoundSystem
  73.  
  74.        mov  ax,@data
  75.        mov  ds,ax
  76.        Mov  Dx,offset FileName
  77.  
  78.        Call Loadmodule            ; Load the module
  79.        Jnc  NoError
  80.  
  81.        mov ah,0
  82.        mov al,3h
  83.        int 10h                   ; Set Text mode
  84.  
  85.        Mov  Ah,09h
  86.        Lea  Dx,Error1
  87.        Int  21h                  ; Print the error-message
  88.  
  89.        Mov  Al,01111010b ; This is what was screwing up the modplayer before
  90.        Mov  Ah,4Ch
  91.        Int  21h                  ; Exit if error...
  92.  
  93. NoError:
  94.        Call StartPlaying             ; Roll it !
  95.        ;Out  21h,Al
  96.        Mov  Ax,Seg SoundDevice
  97.        Mov  Es,Ax                    ; Make ES Point to the PlayerSegment
  98.  
  99. WaitEsc:
  100.  
  101.        In   Al,60h
  102.        Cmp  Al,1
  103.        Jnz  WaitEsc              ; Wait until someone presses ESCAPE.
  104.  
  105.        Mov  Al,0                 ; Let the interrupts come again...
  106.        Out  21h,Al
  107.  
  108.        Call StopPlaying          ; Stop the funky music
  109.  
  110.        Call DeAlloc              ; Deallocate the memory for the module
  111.  
  112.        mov ah,0
  113.        mov al,3h
  114.        int 10h
  115.  
  116.        Mov  Ah,4Ch
  117.        Int  21h                  ; Exit to DOS
  118.  
  119. player EndP
  120.  
  121. dob1    proc far
  122.         Mov  Ax,Seg SoundDevice
  123.         Mov  Es,Ax                    ; Make ES Point to the PlayerSegment
  124.         Mov  bx,Es:Bar1               ; Set BX to the height of bar 1
  125.         mov  ax,bx
  126.         ret
  127. dob1    endp
  128.  
  129. dob2    proc far
  130.         Mov  Ax,Seg SoundDevice
  131.         Mov  Es,Ax                    ; Make ES Point to the PlayerSegment
  132.         Mov  Bx,Es:Bar2               ; Set BX to the height of bar 2
  133.         mov  ax,bx
  134.         ret
  135. dob2    endp
  136. dob3    proc far
  137.         Mov  Ax,Seg SoundDevice
  138.         Mov  Es,Ax                    ; Make ES Point to the PlayerSegment
  139.         Mov  bx,Es:Bar3               ; Set BX to the height of bar 3
  140.         mov  ax,bx
  141.         ret
  142. dob3    endp
  143.  
  144. dob4    proc far
  145.         Mov  Ax,Seg SoundDevice
  146.         Mov  Es,Ax                    ; Make ES Point to the PlayerSegment
  147.         Mov  bx,Es:Bar4               ; Set BX to the height of bar 4
  148.         mov  ax,bx
  149.         ret
  150. dob4    endp
  151.         End player
  152.  
  153. ;╓────────────────────────────────────────────────────────╖
  154. ;║ The Sounddevices:                                      ║
  155. ;║────────────────────────────────────────────────────────║
  156. ;║    01  Soundplayer/Covox at LPT1  (Mono)               ║
  157. ;║    02  Soundplayer/Covox at LPT2  (Mono)               ║
  158. ;║    03  SoundBlaster               (Mono)               ║
  159. ;║    04  Internal Honker            (Mono)               ║
  160. ;║    05  Two Soundplayers LPT1+2    (Stereo)             ║
  161. ;║    06  SoundBlaster Pro           (Stereo)             ║
  162. ;║    07  Stereo SoundPlayer in LPT1 (Stereo)             ║
  163. ;║    08  Stereo SoundPlayer in LPT2 (Stereo)             ║
  164. ;╙────────────────────────────────────────────────────────╜
  165.